<template>
  <div class="table1">
    <h1>table1</h1>
    <el-button type="primary" @click="mytest">主要按钮</el-button>
    <el-table :data="mydata" style="width: 100%">
      <el-table-column prop="date" label="日期" width="180"></el-table-column>
      <el-table-column prop="author" label="author" width="180"></el-table-column>
      <el-table-column prop="title" label="title"></el-table-column>
      <el-table-column label="icon">
        <img :src="img_src" alt>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data () {
    return {
      mydata: [],
      img_src: []
    }
  },
  methods: {
    mytest () {
      console.log('click ok')
      this.$http.get('/posts').then(res => {
        console.log(typeof res.data.posts)
        console.log(res)
        this.mydata = res.data.posts
      })
    }
  }
}
</script>
<style lang="less">
</style>
